{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "de515fbe-d363-4529-b97a-ce5c301eca97",
   "metadata": {},
   "source": [
    "# 下载Labelme样例数据集\n",
    "\n",
    "同济子豪兄 2023-4-15\n",
    "\n",
    "SJB_25_Dataset数据集，包含35张30度直角三角板的图像，标注了以下信息：\n",
    "\n",
    "- 目标检测框：30度直角三角板（sjb_rect）\n",
    "\n",
    "- 关键点：30度角点、60角点、90度角点（Angle_30、Angle_60、Angle_90）\n",
    "\n",
    "- 多段线分割：30度直角三角板区域（sjb_poly）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "903ea2ea-446c-42cf-bbe2-66d751d3fb76",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 下载数据集\n",
    "!rm -rf Ruler_15_Dataset.zip Ruler_15_Dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b4209274-5901-4b07-97b7-0fe006144500",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--2023-04-21 16:09:31--  https://zihao-download.obs.cn-east-3.myhuaweicloud.com/yolov8/datasets/Ruler_15_Dataset.zip\n",
      "正在连接 172.16.0.13:5848... 已连接。\n",
      "已发出 Proxy 请求，正在等待回应... 200 OK\n",
      "长度： 47656571 (45M) [application/zip]\n",
      "正在保存至: “Ruler_15_Dataset.zip”\n",
      "\n",
      "Ruler_15_Dataset.zi 100%[===================>]  45.45M  16.6MB/s    用时 2.7s    \n",
      "\n",
      "2023-04-21 16:09:34 (16.6 MB/s) - 已保存 “Ruler_15_Dataset.zip” [47656571/47656571])\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 下载数据集\n",
    "!rm -rf Ruler_15_Dataset.zip Ruler_15_Dataset\n",
    "!wget https://zihao-download.obs.cn-east-3.myhuaweicloud.com/yolov8/datasets/Ruler_15_Dataset.zip"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2d3c481a-abd8-4474-8645-959a0c8c1759",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 解压\n",
    "!unzip Ruler_15_Dataset.zip >> /dev/null\n",
    "\n",
    "# 删除压缩包\n",
    "!rm -rf Ruler_15_Dataset.zip"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a93c9e95-74fb-49ca-9a12-e23c6adb8bec",
   "metadata": {},
   "source": [
    "## 删除系统自动生成的多余文件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c5c9b94-8f6e-4e05-9ff4-97d52d9c7748",
   "metadata": {},
   "source": [
    "### 查看待删除的多余文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "23c17bcc-bcbc-4ed1-a829-1b63e99d2b80",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '__MACOSX'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "69da9d50-11d1-4071-b818-dbb065a6474e",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.DS_Store'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d4d6ca60-2948-4105-b635-e0d390814067",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "./.ipynb_checkpoints\n"
     ]
    }
   ],
   "source": [
    "!find . -iname '.ipynb_checkpoints'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fe31ccc2-a13f-4f1c-aa27-69369a14f142",
   "metadata": {},
   "source": [
    "### 删除多余文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "8d959813-5703-4e01-ba3e-f27b207d59f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '__MACOSX'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "d2ea0bef-6954-44d5-8478-680c8d7eded1",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '.DS_Store'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "7a2b568c-2685-4a13-90f6-185f60066360",
   "metadata": {},
   "outputs": [],
   "source": [
    "!for i in `find . -iname '.ipynb_checkpoints'`; do rm -rf $i;done"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "68c6c56c-5db5-4e6e-9d15-d955878efe5f",
   "metadata": {},
   "source": [
    "### 验证多余文件已删除"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "2dea6d10-e56f-4775-a055-933d09a9adde",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '__MACOSX'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "23d47236-e846-42bd-9856-a0dd07a23621",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.DS_Store'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a85571be-399b-4e6e-b00e-f3fea415a17e",
   "metadata": {},
   "outputs": [],
   "source": [
    "!find . -iname '.ipynb_checkpoints'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4dded894-44b1-416b-93ac-38bbc98b9f31",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
